<%--
  Created by IntelliJ IDEA.
  User: 86152
  Date: 2022/8/29
  Time: 9:29
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>职工信息管理系统</title>
    <link rel="stylesheet"
          href="${pageContext.request.contextPath}/jsp/good.css">
    <link rel="stylesheet"
          href="${pageContext.request.contextPath}/jsp/a.css">
</head>
<body>
<h1>职工信息管理系统</h1>
<a class="gitee" target="_blank" href="https://gitee.com/joker1499/gittest">Gitee源码地址</a>

<div class="first">
    <a href="/form.jsp" target="_blank">添加数据</a>
    <a href="/delete.jsp" target="_blank">删除数据</a>
    <a href="/update.jsp" target="_blank">更改数据</a>
    <a href="/query.jsp" target="_blank">查询数据</a>
    <a href="${pageContext.request.contextPath}/item/RankBySalary1">工资排序</a>
</div>

<div class="second">
    <table class="table">
        <tr>
            <td class="id">编号</td>
            <td class="name">姓名</td>
            <td class="gender">性别</td>
            <td class="department">所在部门</td>
            <td class="telephone">电话</td>
            <td class="s1">应发工资</td>
            <td class="s2">扣款</td>
            <td class="s3">实发工资</td>
            <td class="delete">便捷操作</td>
        </tr>
        <c:forEach items="${roleList}" var="role">
            <tr>
                <td class="id">${role.id}</td>
                <td class="name">${role.rolename}</td>
                <td class="gender">${role.gender}</td>
                <td class="department">${role.department}</td>
                <td class="telephone">${role.telephone}</td>
                <td class="s1">${role.amount}</td>
                <td class="s2">${role.deduction}</td>
                <td class="s3">${role.salary}</td>
                <td class="delete">
                    <a href="javascript:void(0);" onclick="Delete('${role.id}')">删除</a>
                </td>
            </tr>
        </c:forEach>
    </table>
    <a class="href" href="${pageContext.request.contextPath}/item/RankBySalary1">首页</a>
    <c:if test="${requestScope.page > 1}">
        <a class="href1" href="${pageContext.request.contextPath}/item/RankBySalary${requestScope.page - 1}">上一页</a>
    </c:if>
    <c:if test="${!empty roleList[7] and page + 1 <= total}">
        <a class="href2" href="${pageContext.request.contextPath}/item/RankBySalary${requestScope.page + 1}">下一页</a>
    </c:if>
    <a class="href3" href="${pageContext.request.contextPath}/item/RankBySalary${total}">尾页</a>

    <a class="href4" href="${pageContext.request.contextPath}/item/page1">回到主页</a>
</div>
</body>

<script src="${pageContext.request.contextPath}/js/jquery-3.3.1.js"></script>
<script>
    function Delete(data){
        var l1 = data
        $.ajax({
            type:"get",
            url:"${pageContext.request.contextPath}/item/deleteByIdEasy",
            cache:false,
            data : {id : l1},
            dataType: "json",
            success:function(result){
                if (result.code = 200)
                    alert("请求发送成功")
            }
        })
        window.location.reload();
    }



</script>
</html>
